package com.cxria.pattern.intermediary

class Sale extends AbstractColleague {

    Sale(AbstractMediator mediator) {
        super(mediator)
    }

    void sellIBMComputer(int number){
        mediator.execute('sale.sell', number)
        println "销售IBM电脑${number}台"
    }

    int getSaleStatus(){
        def rand = new Random()
        def saleStatus = rand.nextInt(100)
        println "IBM电脑的销售情况为:${saleStatus}"
        saleStatus as int
    }

    void offSale(){
        mediator.execute('sale.offsell')
    }

}